<div class="form-item clearfix">
	<div class="input-label"><if condition="$data eq NULL or $data['noedit'] neq 1"><span class="asterisk">*</span></if>EKP单号</div>
	<div class="input-item">
	<if condition="$data neq NULL">
		<if condition="$data['noedit'] neq 1">
			<input type="text" name="ekp_number2" class="form-control w150" value="{$data['ekp']}">
			<span class="error-item">必填项</span>
		<else/>
			{$data['ekp']}
		</if>
	<else/>
		<input type="text" name="ekp_number1" class="form-control w150">
		<span class="error-item">必填项</span>
	</if>
	</div>
</div>
<div class="load_foot">
	<if condition="$data['noedit'] neq 1"><if condition="$data['id'] neq NULL"><button type="button" class="btn user-delete left" zid="{$data['id']}">删除</button></if><button type="button" class="btn user-affirm">确认</button></if><button type="button" class="btn btn-default user-cancel ml10" data-dismiss="modal">取消</button>
</div>
<script type="text/javascript">
$(function(){
	//删除
	$(".user-delete").click(function(){
		var zid = $(this).attr('zid');
		$('#modal-delete .delete-confirm').attr('zid',zid);
		$('#modal-delete').fadeIn().addClass('opacity');
		$('.mask').fadeIn();
	})

	//提交
	$('.user-affirm').click(function(){
		var tag = true,
			mid = "{$data['id']}";
		
		if(mid){
			if($("[name='ekp_number2']").val()==''){
				$("[name='ekp_number2']").next('.error-item').show();
				tag = false;
			}
			if($("[name='pid_edit']").val()==-10){
				$("[name='pid_edit']").nextAll('.error-item').show();
				tag = false;
			}
			if($("[name='fill_edit']").val()==-10){
				$("[name='fill_edit']").nextAll('.error-item').show();
				tag = false;
			}
		}else{
			if($("[name='ekp_number1']").val()==''){
				$("[name='ekp_number1']").next('.error-item').show();
				tag = false;
			}
			if($("[name='pid']").val()==-10){
				$("[name='pid']").nextAll('.error-item').show();
				tag = false;
			}
			if($("[name='fill_post']").val()==-10){
				$("[name='fill_post']").nextAll('.error-item').show();
				tag = false;
			}
		}
		if(tag){
			var tdate = $("[name='date']").val(),
				tdate2 = $("[name='start_date']").val(),
				tdate3 = $("[name='end_date']").val(),
				ttype = $('.schedule_btn .active').attr('type'),
				pid = $("[name='pid']").find('option:selected').val(),
				fill = $("[name='fill_post']").find('option:selected').val(),
				pid2 = $("[name='pid_edit']").find('option:selected').val(),
				fill2 = $("[name='fill_edit']").find('option:selected').val();
			if(mid){
				var ekp = $("[name='ekp_number2']").val();
				$.ajax({
					type:"POST",
					async:false,
					dataType:"json",
					data:{"ekp":ekp,"ttype":ttype,"pid":pid2,"fill":fill2,"id":mid},
					url:"__APP__/Index/schedule_list_doedit",
					success:function(data){
						$('#edit_modal').hide();
						success_pop(data.status,data.msg);
					}
				});
			}else{
				var ekp = $("[name='ekp_number1']").val();
				$.ajax({
					type:"POST",
					async:false,
					dataType:"json",
					data:{"ekp":ekp,"tdate":tdate,"tdate2":tdate2,"tdate3":tdate3,"ttype":ttype,"pid":pid,"fill":fill},
					url:"__APP__/Index/schedule_list_doadd",
					success:function(data){
						$('#date_modal').hide();
						success_pop(data.status,data.msg);
					}
				});
				return false
			}
		}
	})
	//取消提示
	$("[name='ekp_number']").focus(function(){
		$(this).next('.error-item').hide();
	})
});
</script>
</body>
</html>
